package com.satis.compose.get.example.pages

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.Button
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import com.satis.compose.get.annotation.PageRoute
import com.satis.compose.get.navigator.LocalPageController
import com.satis.compose.get.widget.GetPage

/**
 * @author sunshaobei on 2023/4/2
 */
@Composable
@PageRoute(route = "/app/getapi")
fun GetApiPage() {
    GetPage(modifier = Modifier.statusBarsPadding().fillMaxSize()) {
        LazyColumn(horizontalAlignment = Alignment.CenterHorizontally){
            item {
                Button(onClick = {
                    //方式一
                    push("/app/passparam",Pair("name","孙绍备"),Pair("age",22),Pair("sex","男"),
                        Pair("test",T("测试",10025)))
                    //方式二
//                  push("/app/passparam/?name=孙绍备&age=22&sex=男&test=%7B%22age%22%3A10025%2C%22name%22%3A%22%E6%B5%8B%E8%AF%95%22%7D")
                }) {
                    Text(text = "参数传递")
                }
            }
        }
    }
}